package com.guardchina.framework.util.utils;

/**
 * 描述：校验工具
 *
 * @author lwb
 * @date 2019/4/4 11:48
 */
public class ValidationUtils {

    /**
     * 正则表示式：校验密码
     * 数字或字母 6-20位
     */
    public static final String REGEX_PASWORD = "^[a-zA-Z0-9]{6,32}$";

    /**
     * 正则表达式：校验手机号码
     * 支持港澳台手机号
     */
    public static final String REGEX_PHONE = "^[1][3-9]\\d{9}$|^([6|9])\\d{7}$|^[0][9]\\d{8}$|^[6][6|8]\\d{5}$";

    /**
     * 正则表达式：验证邮箱
     */
    public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     * 正则表达式：验证汉字
     */
    public static final String REGEX_CHINESE = "^[\u4e00-\u9fa5],{0,}$";

    /**
     * 正则表达式：验证URL
     */
    public static final String REGEX_URL = "(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&amp;%@!\\-\\/]))?";

    /**
     * 正则表达式：验证IP地址
     */
    public static final String REGEX_IP_ADDR = "(25[0-5]|2[0-4]\\d|[0-1]\\d{2}|[1-9]?\\d)";

    /**
     * 正则表达式：身份证
     */
    public static final String REGEX_IDCARD = "^(\\d{15}$|^\\d{18}$|^\\d{17}(\\d|X|x))$";

    /**
     * 正则表达式：中文名
     * 2-10位
     */
    public static final String REGEX_ZH_NAME = "[\\u4e00-\\u9fa5 \\.。]{2,10}";
}
